<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="./../../template/template.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ror="http://richfaces.org/rich"
                xmlns:f="http://java.sun.com/jsf/core">

    <ui:define name="title">
        Cajas - Peluquería
    </ui:define>

    <ui:define name="cabecera">
        cabecera
    </ui:define>

    <ui:define name="cuerpo">
            <ror:panel id="panel1" rendered="#{cajaBean.nuevo}">
                <h:panelGrid columns="2">
                    <h:outputLabel value="#{bundle.cajaCodCajTit}:" for="codCaj"/>
                    <h:inputText id="codCaj" required="true" size="10" maxlength="#{bundle.cajaCodCajLength}" value="#{cajaBean.entity.codCaj}" disabled="#{cajaBean.modificar}">
                        <f:ajax event="blur" render="panel1"/>
                    </h:inputText><h:message for="codCaj" errorClass="msgError"/>
                    <h:outputLabel value="#{bundle.cajaDesCajTit}:" for="desCaj"/>
                    <h:inputText id="desCaj" required="true" size="50" maxlength="#{bundle.cajaDesCajLength}" value="#{cajaBean.entity.desCaj}">
                        <f:ajax event="blur" render="panel1"/>
                    </h:inputText><h:message for="desCaj" errorClass="msgError"/>
                </h:panelGrid>
                <h:commandButton styleClass="b_naranja" value="#{bundle.guardar}" action="#{cajaBean.guardar()}"/>
                <h:commandButton styleClass="b_azul" value="#{bundle.cancelar}" action="#{cajaBean.start()}"/>
            </ror:panel>
            <ror:panel id="panel2" rendered="#{!cajaBean.nuevo}">
                <h:panelGrid columns="4">
                    <h:outputLabel value="#{bundle.cajaCodCajTit}:" for="codCajBuscar"/>
                    <h:inputText id="codCajBuscar" size="10" maxlength="#{bundle.cajaCodCajLength}" value="#{cajaBean.entity.codCaj}"/>
                    <h:outputLabel value="#{bundle.cajaDesCajTit}:" for="desCajBuscar"/>
                    <h:inputText id="desCajBuscar" size="50" maxlength="#{bundle.cajaDesCajLength}" value="#{cajaBean.entity.desCaj}"/>
                </h:panelGrid>
                <h:messages id="messages" infoClass="msgInfo" errorClass="msgError" warnClass="msgWarn" layout="table"/>
                <ror:panel rendered="#{cajaBean.model.rowAvailable}">
                    <h:dataTable value="#{cajaBean.model}" var="item" border="0" cellpadding="2" cellspacing="0" rowClasses="jsfcrud_odd_row,jsfcrud_even_row" rules="all" style="border:solid 1px">
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.cajaCodCajTit}"/>
                            </f:facet>
                            <h:outputText value="#{item.codCaj}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.cajaDesCajTit}"/>
                            </f:facet>
                            <h:outputText value="#{item.desCaj}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="&nbsp;"/>
                            </f:facet>
                            <h:commandLink action="#{cajaBean.modificarRegistro()}" value="#{bundle.modificar}"/>
                            <h:outputText value=" "/>
                            <h:commandLink action="#{cajaBean.eliminarRegistro()}" value="#{bundle.eliminar}"/>
                        </h:column>
                    </h:dataTable>
                </ror:panel>
                <h:commandButton value="#{bundle.nuevo}" styleClass="b_naranja" action="#{cajaBean.nuevoRegistro}"/>
            </ror:panel>    
    </ui:define>

    <ui:define name="pie">
        pie
    </ui:define>

</ui:composition>
